#! /usr/bin/python
# -*- encoding utf-8 -*-
'''
Test suite on SocketHttp class
'''

import unittest
from http_socket import HttpSocket

class HttpTestCase(unittest.TestCase):

    def setUp(self):
        self.s = HttpSocket()

    def tearDown(self):
        self.s = None
 
    def test_start_client(self):
        host_local = "127.0.0.1"
        host_baidu = "www.baidu.com"
        host_yahoo = "www.yahoo.com"
        port1 = 8080
        port2 = 80
        self.assertEqual(self.s.start_client(host_local, port1),'200', 'from local host recieve data fail')
        self.assertEqual(self.s.start_client(host_baidu, port2),'200', 'from baidu host recieve data fail')
        self.assertEqual(self.s.start_client(host_yahoo, port2),'200', 'from yahoo host recieve data fail')
               
if __name__ == '__main__':
 
    # Make sure that test cases are executed in order
    suite = unittest.TestSuite()
    suite.addTest(HttpTestCase("test_start_client")) 

    runner = unittest.TextTestRunner()
    runner.run(suite)


